﻿using System;
using System.Globalization;
using JetBrains.Annotations;

namespace OpenWaves
{
    public static class Log
    {
        private static ILoggingService LoggingService
        {
            get { return ServiceLocator.Resolve<ILoggingService>(); }
        }


        public static void Debug(string message)
        {
            LoggingService.Log(LogEntrySeverity.Debug, message);
        }

        [StringFormatMethod("format")]
        public static void Debug(string format, params object[] args)
        {
            LoggingService.Log(LogEntrySeverity.Debug, String.Format(CultureInfo.InvariantCulture, format, args));
        }

        [StringFormatMethod("format")]
        public static void Debug(Exception exception, string format, params object[] args)
        {
            LoggingService.Log(LogEntrySeverity.Debug, exception, String.Format(CultureInfo.InvariantCulture, format, args));
        }

        public static void Info(string message)
        {
            LoggingService.Log(LogEntrySeverity.Info, message);
        }

        [StringFormatMethod("format")]
        public static void Info(string format, params object[] args)
        {
            LoggingService.Log(LogEntrySeverity.Info, String.Format(CultureInfo.InvariantCulture, format, args));
        }

        public static void Error(Exception exception, string message)
        {
            LoggingService.Log(LogEntrySeverity.Error, exception, message);
        }

        [StringFormatMethod("format")]
        public static void Error(Exception exception, string format, params object[] args)
        {
            LoggingService.Log(LogEntrySeverity.Error, exception, String.Format(CultureInfo.InvariantCulture, format, args));
        }

        public static void Warning(string message)
        {
            LoggingService.Log(LogEntrySeverity.Info, message);
        }

        [StringFormatMethod("format")]
        public static void Warning(string format, params object[] args)
        {
            LoggingService.Log(LogEntrySeverity.Warning, String.Format(CultureInfo.InvariantCulture, format, args));
        }

        public static void Warning(Exception exception, string message)
        {
            LoggingService.Log(LogEntrySeverity.Warning, exception, message);
        }

        [StringFormatMethod("format")]
        public static void Warning(Exception exception, string format, params object[] args)
        {
            LoggingService.Log(LogEntrySeverity.Warning, exception, String.Format(CultureInfo.InvariantCulture, format, args));
        }
    }
}